﻿@model QRCode2.Models.HomeForSale

@{
    ViewBag.Title = "Edit";
}

<h2>Edit</h2>

@using (Html.BeginForm("Edit", "HomeForSale", FormMethod.Post, new { enctype = "multipart/form-data" }))
{

    <fieldset>
        <legend>HomeForSale</legend>

        @Html.HiddenFor(model => model.MainPicture)
        @Html.HiddenFor(model => model.Picture1)
        @Html.HiddenFor(model => model.Picture2)
        @Html.HiddenFor(model => model.Picture3)
        @Html.HiddenFor(model => model.Picture4)
        @Html.HiddenFor(model => model.Picture5)
        @Html.HiddenFor(model => model.Movie)

        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Description)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Description)
            @Html.ValidationMessageFor(model => model.Description)
        </div>

        @if (ViewBag.QRCodeExists == "No")
        {   
            <label for="lblQRCode">Create QRCode</label>
            <input id="cbQRCode" name="chkQRCode" type="checkbox" value="true" />
        <br />
        }

        @if (ViewBag.QRCodeExists == "Yes")
        {
            <a href= "@Url.Content(ViewBag.QRCodeLocation)"> QR Code </a>
            <br /> 
            <a href= "@Url.Content(ViewBag.FlyerLocation)"> Flyer </a>  
            <br />
            <br />
        }

        <div class="editor-label">
            @Html.LabelFor(model => model.Address)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Address)
            @Html.ValidationMessageFor(model => model.Address)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.StartDate)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.StartDate)
            @Html.ValidationMessageFor(model => model.StartDate)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.EndDate)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.EndDate)
            @Html.ValidationMessageFor(model => model.EndDate)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.DaysOnMarket)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.DaysOnMarket)
            @Html.ValidationMessageFor(model => model.DaysOnMarket)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Heating)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Heating)
            @Html.ValidationMessageFor(model => model.Heating)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.YearBuilt)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.YearBuilt)
            @Html.ValidationMessageFor(model => model.YearBuilt)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.AskingPrice)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.AskingPrice)
            @Html.ValidationMessageFor(model => model.AskingPrice)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.GeoLocation)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.GeoLocation)
            @Html.ValidationMessageFor(model => model.GeoLocation)
        </div>

        <br />
        <img src= "@Url.Content(ViewBag.MainPicture)" alt="MainPicture" />
        <br />
        Update Main Picture
        <br />
        <input type="file" id="MainPictureToUpload" name="MainPicture" />
        <br />

        <div class="editor-label">
            @Html.LabelFor(model => model.Picture1Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Picture1Name)
            @Html.ValidationMessageFor(model => model.Picture1Name)
        </div>

        <br />
        <img src= "@Url.Content(ViewBag.Picture1)" alt="Picture1" />
        <br />
        Update Picture 1
        <br />
        <input type="file" id="Picture1ToUpload" name="Picture1" />
        <br />

        <div class="editor-label">
            @Html.LabelFor(model => model.Picture2Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Picture2Name)
            @Html.ValidationMessageFor(model => model.Picture2Name)
        </div>

        <br />
        <img src= "@Url.Content(ViewBag.Picture2)" alt="Picture2" />
        <br />
        Update Picture 2
        <br />
        <input type="file" id="Picture2ToUpload" name="Picture2" />
        <br />

        <div class="editor-label">
            @Html.LabelFor(model => model.Picture3Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Picture3Name)
            @Html.ValidationMessageFor(model => model.Picture3Name)
        </div>

        <br />
        <img src= "@Url.Content(ViewBag.Picture3)" alt="Picture3" />
        <br />
        Update Picture 3
        <br />
        <input type="file" id="Picture3ToUpload" name="Picture3" />
        <br />

        <div class="editor-label">
            @Html.LabelFor(model => model.Picture4Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Picture4Name)
            @Html.ValidationMessageFor(model => model.Picture4Name)
        </div>

        <br />
        <img src= "@Url.Content(ViewBag.Picture4)" alt="Picture4" />
        <br />
        Update Picture 4
        <br />
        <input type="file" id="Picture4ToUpload" name="Picture4" />
        <br />

        <div class="editor-label">
            @Html.LabelFor(model => model.Picture5Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Picture5Name)
            @Html.ValidationMessageFor(model => model.Picture5Name)
        </div>

        <br />
        <img src= "@Url.Content(ViewBag.Picture5)" alt="Picture5" />
        <br />
        Update Picture 5
        <br />
        <input type="file" id="Picture5ToUpload" name="Picture5" />
        <br />

        @if (ViewBag.Movie != "")
        {
            <a href= "@Url.Content(ViewBag.Movie)"> Movie </a>
            <br /> 
        }

         <br />
        Update Movie
        <br />
        <input type="file" id="MovieToUpload" name="Movie" />
        <br />

        <div class="editor-label">
            @Html.LabelFor(model => model.Active)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Active)
            @Html.ValidationMessageFor(model => model.Active)
        </div>

        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
